<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>大连大学附属中山医院</title>
<script type="text/javascript" src="${basePath}/static/publics/assets/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
    <div class="list_NR">
       <div class="loc">
            <h3>病案示踪</h3>
            <ul class="loc_loc">病案示踪 > 病案示踪
            </ul>
        </div>
        <div class="list_con_table">
        	
          <div class="search_table">
                <ul class="clearfix" style="margin-bottom:0;">
				    <li class="Label_1">身份证号：&nbsp;</li>
				    <li class="Label_2" ><input class="input_box" type="text" name='idCard' readonly="readonly" value="${medTraceQuery.idCard }"/></li>
					<li class="Label_1">识别码：&nbsp;</li>
				    <li class="Label_2"><input class="input_box"  type="text" name="mrId" readonly="readonly" value="${medTraceQuery.mrId }" /></li>
				    <li class="Label_1">姓名：&nbsp;</li>
				    <li class="Label_2" ><input class="input_box" type="text" name="name" readonly="readonly" value="${medTraceQuery.name }" /></li>
                	
                    <li class="Label_1">病案踪迹：&nbsp;</li>
				    <li class="Label_2">
				    	<select class="input_box" name="traceTypeId" id="traceTypeId">
					  		<option value="">请选择</option>
					  		<c:forEach var="traceType" items="${traceTypes }">
					  			<c:choose>
					  				<c:when test="${medTraceQuery.traceTypeId==traceType.id}">
					  					<option value="${traceType.id}"  selected="selected">${traceType.name }</option>
					  				</c:when>
					  				<c:otherwise>
					  					<option value="${traceType.id}">${traceType.name }</option>
					  				</c:otherwise>
					  			</c:choose>
					  		</c:forEach>
						</select>
					
					</li>
					<li class="Label_1" >病案踪迹日期：&nbsp;</li>
                    <li class="Label_2">
                    	<input class="input_box" style="width:98%;" type="text" id="traceDate" name="traceDate" value='' onFocus="WdatePicker()" />
                    </li>  
                    <li class="Label_5">
                        <div class="right" style="text-align:right">
                            <a id="Add" onclick="insertMedTrace()">保存</a>
                        </div>
                    </li>  
                </ul>
                </div>
                 <form action="${basePath}/statis/medTraceDetail" method="get" id="queryForm">
                 	<input class="input_box" style="display:none" type="text" name='firstGuid' id="guid" value="${medTraceQuery.firstGuid }"/>
     		 	 </form>
        </div>
             <table class="Search_tableList" border-collapse:collapse;" cellpadding="0" cellspacing="0">
                <tr>		
             		<td class="tdLabel_4">身份证号</td>
                    <td class="tdLabel_4">识别码</td>
                    <td class="tdLabel_4">姓名</td>
                    <td class="tdLabel_4">记录日期</td>
                    <td class="tdLabel_4">病案踪迹</td>
                    <td class="tdLabel_4">操作者</td>
                </tr>
                
                <tbody id="tbody">
 					<c:forEach var="medTrace" items="${treatmentTraces }">
 						<tr>
 							<td class="tdLabel_5">${medTrace.id_cards }</td>
 							<td class="tdLabel_5">${medTrace.mr_id }</td>
 							<td class="tdLabel_5">${medTrace.patient_name }</td>
 							<td class="tdLabel_5"><fmt:formatDate value="${medTrace.trace_date }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
 							<td class="tdLabel_5">${medTrace.trace_type_name }</td>
 							<td class="tdLabel_5">${medTrace.user_id }</td>
 						</tr>
 					</c:forEach>
                </tbody>
            </table>
        </div>
</body>
<!--JS部分-->
<script type="text/javascript">
	function insertMedTrace(){
		var guid = $("#guid").val();
		var date = $("#traceDate").val();
		var type = $("#traceTypeId").val();
		$.ajax({
			type:"post",
			url:"${basePath}/statis/insertMedTrace",
			data:{firstGuid:guid,traceDate:date,traceTypeId:type},
			success:function(data){
				if(data!=null){
					if(data.success){
						
						$("#queryForm").submit();
					}
					alert(data.msg);
				}else{
					alert("病案示踪添加失败");
				}
			}
			
		});
	}
</script>
</html>